Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Render location.go #25

Merged
merged 19 commits into from
Mar 8, 2024
Merged

feat: Render location.go #25

merged 19 commits into from
Mar 8, 2024

Conversation

sebastianczech
Copy link
Contributor

Description

PR delivers logic to generate location.go.

Motivation and Context

#24

How Has This Been Tested?

Automated tests are included into PR.

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes if appropriate.
  • All new and existing tests passed.

pkg/translate/names.go Outdated Show resolved Hide resolved
pkg/translate/structs.go Outdated Show resolved Hide resolved
pkg/translate/structs.go Outdated Show resolved Hide resolved
@sebastianczech sebastianczech marked this pull request as ready for review March 5, 2024 12:41
pkg/translate/funcs.go Outdated Show resolved Hide resolved
pkg/translate/structs.go Show resolved Hide resolved
specs/policies/security-policy-rule.yaml Outdated Show resolved Hide resolved
Copy link
Contributor

@pimielowski pimielowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice!

I run the 'go run main.go' from the cmd/mktp directory and it failed. I assumed that we need to go to that directory to run the script, let's talk about it offline.

Also I run the tests (Windows+WSL2) and I got error ->

=== RUN TestCreateFullFilePath
--- PASS: TestCreateFullFilePath (0.00s)
=== RUN TestListOfTemplates
--- PASS: TestListOfTemplates (0.00s)
=== RUN TestParseTemplateForInterfaces
generator_test.go:67:
Error Trace: /c/repo/github.com/pan-os-codegen/pkg/generate/generator_test.go:67
Error: Not equal:
expected: "package address\n\ntype Specifier func(Entry) (any, error)\n\ntype Normalizer interface {\n Normalize() ([]Entry, error)\n}"
actual : "package address\r\n\r\ntype Specifier func(Entry) (any, error)\r\n\r\ntype Normalizer interface {\r\n Normalize() ([]Entry, error)\r\n}"

                            Diff:
                            --- Expected
                            +++ Actual
                            @@ -1,7 +1,7 @@
                            -package address
                            -
                            -type Specifier func(Entry) (any, error)
                            -
                            -type Normalizer interface {
                            -    Normalize() ([]Entry, error)
                            +package address
                            +
                            +type Specifier func(Entry) (any, error)
                            +
                            +type Normalizer interface {
                            +    Normalize() ([]Entry, error)
                             }
            Test:           TestParseTemplateForInterfaces

--- FAIL: TestParseTemplateForInterfaces (0.00s)
FAIL
FAIL github.com/paloaltonetworks/pan-os-codegen/pkg/generate 0.009s
=== RUN TestConfig
--- PASS: TestConfig (0.00s)
=== RUN TestUnmarshallAddressSpecFile
--- PASS: TestUnmarshallAddressSpecFile (0.00s)
=== RUN TestMarshallAddressSpecFile
--- PASS: TestMarshallAddressSpecFile (0.00s)
=== RUN TestGetNormalizations
--- PASS: TestGetNormalizations (0.01s)
=== RUN TestSanity
--- PASS: TestSanity (0.00s)
=== RUN TestValidation
--- PASS: TestValidation (0.00s)
PASS
ok github.com/paloaltonetworks/pan-os-codegen/pkg/properties 0.012s
=== RUN TestAsEntryXpath
--- PASS: TestAsEntryXpath (0.00s)
=== RUN TestPackageName
--- PASS: TestPackageName (0.00s)
=== RUN TestLocationType
--- PASS: TestLocationType (0.00s)
=== RUN TestOmitEmpty
--- PASS: TestOmitEmpty (0.00s)
PASS
ok github.com/paloaltonetworks/pan-os-codegen/pkg/translate 0.004s
FAIL

It was under the WSL2(ubuntu), but it could be environmental issue

pkg/generate/generator.go Show resolved Hide resolved
pkg/translate/funcs.go Outdated Show resolved Hide resolved
@sebastianczech
Copy link
Contributor Author

sebastianczech commented Mar 8, 2024

Looks nice!

I run the 'go run main.go' from the cmd/mktp directory and it failed. I assumed that we need to go to that directory to run the script, let's talk about it offline.

@pimielowski you need to run with config file as described https://github.com/PaloAltoNetworks/pan-os-codegen/blob/render-location/README.md:

go run cmd/mktp/main.go cmd/mktp/config.yaml

templates/sdk/entry.tmpl Show resolved Hide resolved
@sebastianczech sebastianczech merged commit 65727a4 into main Mar 8, 2024
1 check passed
@sebastianczech sebastianczech deleted the render-location branch March 8, 2024 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants